package org.example.controller;

import org.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class TestController {
    @Autowired
    RestTemplate restTemplate;
    @Autowired
    private UserService userService;
    @GetMapping("/test")
    public String test() {
        return restTemplate.getForObject("http://cloud-users/test", String.class);
    }
    @GetMapping("testOpenFeign")
    public String test3() throws InterruptedException {
        //        睡眠验证lb重试次数
        System.out.println("方法开始调用");
        Thread.sleep(1);
        return "OPENFEIGN";
    }
    @GetMapping("/testGateWay")
    public String test4()  {
        return "test";
    }
    @GetMapping("/testSeata")
    public void test5()  {
        userService.add();
    }
}
